package com.imc.platform.base.common.service;

import com.imc.platform.base.common.dao.ISwitchMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/*
 * 类描述：开关公用类
 * 开发者：YT
 * 创建日期：2018/10/22 22:00
 */
@Transactional
@Slf4j
@Service
public class SwitchServiceImpl implements ISwitchService {

    @Autowired
    ISwitchMapper iSwitchMapper;

    /**
     *QY 2018/9/3 10:16
     *方法描述：更改状态
     **/
    @Override
    public int updateState(String state, String id, String table_name) {
        if("false".equals(state)){
            state="0";
        }else if("true".equals(state)){
            state="1";
        }
        try {
            return iSwitchMapper.updateState(state,id, table_name);
        }catch(Exception e){
            e.printStackTrace();
        }
        return 0;
    }
}
